package com.easy;

/**
 * Created by Lxk on 2019/6/2.
 */
public class Solution283 {

    public void moveZeroes(int[] nums) {
        int count = 0;
        for(int val : nums){
            if(val==0){
                count++;
            }
        }

        for(int i = 0;i < count; i++ ){
            for(int j=0;j < nums.length-1-i; j++){
                if(nums[j]==0){
                    int temp = nums[j];
                    nums[j] = nums[j+1];
                    nums[j+1] = temp;
                }
            }
        }
    }

    public static void main(String[] args) {
        int[] arr = {4,2,4,0,0,3,0,5,1,0};
        Solution283 solution283 = new Solution283();
        solution283.moveZeroes(arr);
    }

}
